﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Data.SqlClient;

public partial class ThongTinhCaNhan : System.Web.UI.Page
{
    KH_Admin kh = new KH_Admin();
   
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            if (Session["user"] != null)
            {
                FormView1.DataSource = kh.LayDSKH();
                FormView1.DataBind();
            }
            else 
            {
                Label1.Text = "Bạn chưa đăng nhập";
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
 
    }
    protected void FormView1_PageIndexChanging(object sender, FormViewPageEventArgs e)
    {

    }
    protected void luu_Click(object sender, EventArgs e)
    {

    }
    protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
    {
        TextBox txtmakh = (TextBox)FormView1.FindControl("TextBox10");
        string malkh = txtmakh.Text;
                
        TextBox txthoten = (TextBox)FormView1.FindControl("TextBox1");
        string hoten = txthoten.Text;

        TextBox txttendn = (TextBox)FormView1.FindControl("TextBox2");
        string tendn = txttendn.Text;

        TextBox txtmatkhau = (TextBox)FormView1.FindControl("TextBox3");
        string matkhau = txtmatkhau.Text;

        TextBox txtgioitinh = (TextBox)FormView1.FindControl("TextBox4");
        string gioitinh = txtgioitinh.Text;

        TextBox txtngaysinh = (TextBox)FormView1.FindControl("TextBox5");
        string ngaysinh = txtngaysinh.Text;

        TextBox txtdiachi = (TextBox)FormView1.FindControl("TextBox6");
        string diachi = txtdiachi.Text;

        TextBox txtemail = (TextBox)FormView1.FindControl("TextBox7");
        string email = txtemail.Text;

        TextBox txtdienthoai = (TextBox)FormView1.FindControl("TextBox8");
        string dienthoai = txtdienthoai.Text;

        kh.Sua_khachang(int.Parse( malkh),hoten, tendn, matkhau, bool.Parse( gioitinh), ngaysinh, diachi, email, dienthoai);

        FormView1.DataSource = kh.LayDSKH();
        FormView1.DataBind();
       }
}
